<template>
  <div class="report">
    <a-form
      ref="formRef"
      name="advanced_search"
      class="ant-advanced-search-form"
      :model="formState"
      @finish="onFinish"
    >
      <a-row :gutter="16">
        <a-col :span="10">
          <a-form-item name="时间查询" label="时间查询">
            <a-date-picker
              v-model:value="formState.queryTime"
              value-format="YYYY-MM-DD"
            />
          </a-form-item>
        </a-col>
        <a-col :span="4">
          <a-button type="primary" html-type="submit">查询</a-button>
        </a-col>
      </a-row>
    </a-form>
    <a-descriptions
      title="小莫每日报表"
      bordered
      :column="{ xxl: 4, xl: 3, lg: 3, md: 3, sm: 2, xs: 1 }"
    >
      <a-descriptions-item label="每日新注册用户">
        {{ dataSource.registeredNum }}
      </a-descriptions-item>
      <a-descriptions-item label="每日写作用户数量">
        {{ dataSource.writingNum }}
      </a-descriptions-item>
      <a-descriptions-item label="每日作品数量">
        {{ dataSource.worksNum }}
      </a-descriptions-item>
      <a-descriptions-item label="全部注册用户">
        {{ dataSource.allRegisteredNum }}
      </a-descriptions-item>
      <a-descriptions-item label="作品总数量">
        {{ dataSource.allWorksNum }}
      </a-descriptions-item>
      <a-descriptions-item label="总字数">
        {{ dataSource.wordsNum }}
      </a-descriptions-item>
      <a-descriptions-item label="满意数量">
        {{ dataSource.satisfiedNum }}
      </a-descriptions-item>

      <a-descriptions-item label="不满意数量 ">
        {{ dataSource.unSatisfiedNum }}
      </a-descriptions-item>
      <a-descriptions-item label="查重人数">
        {{ dataSource.dupCheckUserNum }}
      </a-descriptions-item>
      <a-descriptions-item label="查重次数 ">
        {{ dataSource.dupCheckNum }}
      </a-descriptions-item>
      <a-descriptions-item label="查重金额">
        {{ dataSource.dupCheckMoney }}
      </a-descriptions-item>
      <a-descriptions-item label="受邀注册用户">
        {{ dataSource.invitationUserNum }}
      </a-descriptions-item>
      <a-descriptions-item label="领取doc福利用户">
        {{ dataSource.welfareNumDoc }}
      </a-descriptions-item>
      <a-descriptions-item label="领取paperpass福利用户">
        {{ dataSource.welfareNumPp }}
      </a-descriptions-item>
      <a-descriptions-item label="文献上传数">
        {{ dataSource.uploadFileNum }}
      </a-descriptions-item>

      <a-descriptions-item label="笔记数量 ">
        {{ dataSource.noteNum }}
      </a-descriptions-item>
      <a-descriptions-item label="笔记用户数量">
        {{ dataSource.noteUserNum }}
      </a-descriptions-item>
      <a-descriptions-item label="改写数量">
        {{ dataSource.reWriterNum }}
      </a-descriptions-item>
      <a-descriptions-item label="普通改写数量">
        {{ dataSource.ordinaryRewriteNum }}
      </a-descriptions-item>
      <a-descriptions-item label="改写用户数量">
        {{ dataSource.reWriterUserNum }}
      </a-descriptions-item>
      <a-descriptions-item label="改写金额">
        {{ dataSource.reWriterMoney }}
      </a-descriptions-item>
      <a-descriptions-item label="付费改写用户数量">
        {{ dataSource.payReWriterUserNum }}
      </a-descriptions-item>
      <a-descriptions-item label="开通会员金额">
        {{ dataSource.payMemberMoney }}
      </a-descriptions-item>

      <a-descriptions-item label="会员1开通数量">
        {{ dataSource.payMemberNum1 }}
      </a-descriptions-item>
      <a-descriptions-item label="会员2开通数量">
        {{ dataSource.payMemberNum2 }}
      </a-descriptions-item>
      <a-descriptions-item label="会员3开通数量 ">
        {{ dataSource.payMemberNum3 }}
      </a-descriptions-item>
      <a-descriptions-item label="会员4开通数量">
        {{ dataSource.payMemberNum4 }}
      </a-descriptions-item>
      <a-descriptions-item label="强力改写字数">
        {{ dataSource.powerRewritingWords }}
      </a-descriptions-item>
      <a-descriptions-item label="邀请用户付费人数">
        {{ dataSource.invitationPayUserNum }}
      </a-descriptions-item>
    </a-descriptions>
  </div>
</template>

<script>
  //   import { message } from 'ant-design-vue'
  import { statisticsReport } from '../../api/table.js'
  import { reactive, ref } from 'vue'
  export default {
    name: 'report',
    setup() {
      const formState = reactive({
        queryTime: ref(),
      })
      const dataSource = ref([])
      const initPage = async () => {
        const { queryTime } = formState
        let res = await statisticsReport({ queryTime })
        console.log(res)
        if (res.code) {
          dataSource.value = res.data
        } else {
          dataSource.value = []
        }
      }

      const onFinish = () => {
        initPage()
      }

      initPage()
      return {
        formState,
        initPage,
        onFinish,
        dataSource,
      }
    },
  }
</script>

<style lang="less" scoped></style>
